<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>首页</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_1658828_vud4w73neg.css">
    <link rel="stylesheet" href="/admin/css/style.css">
</head>

<body class="bg-light">
    <%- include('../header.html')  -%>

    <div class="container-fluid vh-100">
        <div class="row h-100">
            <%- include('../navs.html') -%>
            <div class="col-10">
                <div class="p-3 border mb-3 bg-white">
                    <h4 class="mb-0">我的出题--共<%= myArticleCount %>条</h4>
                </div>
                <div class="row mt-3">
                    <div class="col">
                        <div class="card">
                            <div class="card-header bg-primary text-white d-flex justify-content-between">
                                <h6 class="mb-0 align-self-center">选题列表</h6>
                            </div>
                            <div class="card-body">
                                <table class="table table-hover text-center">
                                    <thead>
                                        <tr>
                                            <th>ID</th>
                                            <th>标题</th>
                                            <th>操作</th>
                                            <th>状态</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <% articles.forEach(article => { %>

                                        <tr>
                                            <th><%= article.id %> </th>
                                            <td><%= article.title %> </td>
                                            <td>
                                                <a href="/admin/article/my/edit/<%=article.id%>" class="text-primary" title="编辑"><i
                                                        class="iconfont icon-bianji"></i>编辑/反选</a>
                                                <button onclick="del(<%=article.id%>)" class="btn-link text-danger p-0 border-0 bg-transparent"
                                                    title="删除"><i class="iconfont icon-delete"></i>删除</button>
                                            </td>
                                            <td>
                                                <% if (article.code == 0) { %>
                                                    未审核
                                                <% }else if (article.code == 1) { %>
                                                    已通过
                                                <% }else if (article.code == 2) { %>
                                                    未通过
                                                <% }else if (article.code == 3) { %>
                                                    已反选
                                                <% }else if (article.code == 9) { %>
                                                    未提交
                                                <% } %>
                                            </td>
                                        </tr>

                                        <% }) %>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/holder/2.9.6/holder.min.js"></script>
    <script src="https://gw.alipayobjects.com/os/lib/antv/g2/3.5.12/dist/g2.min.js"></script>
    <script src="https://gw.alipayobjects.com/os/antv/pkg/_antv.data-set-0.10.2/dist/data-set.min.js"></script>
    <script src="/admin/js/public.js"></script>
    <script>

        function del(id) {
            $.getJSON('/admin/article/del', { id: id }, function (res) {
                if (res.code == 1) {
                    showToasts('成功', '删除成功')
                    setTimeout(function () {
                        location.reload()
                    }, 1000)
                } else {
                    showToasts('失败', '删除失败')
                }
            })
        }
    </script>
</body>

</html>·